package com.dk.controller;


import com.dk.model.CraftRoute;
import com.dk.service.CraftRouteService;
import com.dk.vo.CraftRouteVO;
import com.dongdongshop.data.Result;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 工艺线路 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-20
 */
@RestController
@RequestMapping("craftRoute")
public class CraftRouteController {

    @Autowired
    private CraftRouteService craftRouteService;

    @GetMapping("getInfoList")
    public Result getInfoList(CraftRouteVO craftRouteVO){
        List<CraftRouteVO> craftRouteVOList = craftRouteService.getInfoList(craftRouteVO);
        return Result.OK().setData(craftRouteVOList);
    }

    @PostMapping("insertInfoCraftRoute")
    public Result insertInfoCraftRoute(CraftRouteVO craftRouteVO){
        craftRouteService.insertInfoCraftRoute(craftRouteVO);
        return Result.OK();
    }

    @GetMapping("getInfoCraftRouteById")
    public Result getInfoCraftRouteById(String craftRouteId){
        CraftRouteVO craftRouteVO = craftRouteService.getInfoCraftRouteById(craftRouteId);
        return Result.OK().setData(craftRouteVO);
    }

    @PostMapping("updateInfoCraftRouteById")
    public Result updateInfoCraftRouteById(CraftRouteVO craftRouteVO){
        craftRouteService.updateInfoCraftRouteById(craftRouteVO);
        return Result.OK();
    }

    @DeleteMapping("deleteInfoCraftRouteById")
    public Result deleteInfoCraftRouteById(String craftRouteId){
        craftRouteService.deleteInfoCraftRouteById(craftRouteId);
        return Result.OK();
    }
}

